package com.zwj.learning.timetable.controller;

import com.zwj.common.R;
import com.zwj.learning.timetable.service.SchoolOpenService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.time.ZoneId;

@RestController
@RequestMapping("/schoolOpen")
public class SchoolOpenController {

    @Resource
    private SchoolOpenService schoolOpenService;

    @GetMapping("/getSchoolOpenTime/{semester}")
    public R<Object> getSchoolOpenTime(@PathVariable String semester) {

        return R.success(schoolOpenService.getSchoolOpenTime(semester).getStartTime().atZone(ZoneId.systemDefault()).toInstant().toEpochMilli());
    }
}
